<?php if(!class_exists('raintpl')){exit;}?><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?>
<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("navigator") . ( substr("navigator",-1,1) != "/" ? "/" : "" ) . basename("navigator") );?>

<div id = "container">
	<h1 class = "header">เพิ่มข้อมูลพื้นฐาน</h1>

	<form action = '<?php echo $action;?>' method = 'post' enctype='multipart/form-data' id = "common-form">
		<input type = "hidden" name = "id" value = "<?php echo $id;?>">
		<ul class = 'form'>
			<li class = 'node'>
				<label for='name' class = 'label'>ชื่อข้อมูลพื้นฐาน : </label>
				<input type = 'text' id = 'name' class = 'input validate[required] text-input w600' name = 'name' value = "<?php echo $data['name'];?>">
				<span class='require'>*</span>
				<span class = 'desc'></span>
			</li>
			<li class = 'node'>
				<label for='target' class = 'label'>จำนวน : </label>
				<input type = 'text' id = 'target' class = 'input validate[required] text-input w50' name = 'target' value = "<?php echo $data['target'];?>">
				<span class='require'>*</span>
			</li>
			<li class = 'node'>
				<label for='group' class = 'label'>องค์ประกอบที่ : </label>
				<select name = 'group'>
				<?php $counter1=-1; if( isset($group) && is_array($group) && sizeof($group) ) foreach( $group as $key1 => $value1 ){ $counter1++; ?>
					<?php if( $value1["id"]==$data['gid'] ){ ?>
						<option value = '<?php echo $value1["id"];?>' selected><?php echo $value1["name"];?></option>
					<?php }else{ ?>
						<option value = '<?php echo $value1["id"];?>'><?php echo $value1["name"];?></option>
					<?php } ?>
				<?php } ?>
				</select>
				<span class = 'desc'></span>
			</li>
			<li class = 'node'>
				<label for='upload' class = 'label'>แนบไฟล์ : </label>
				<input type = "file" name = "upload" id = "upload">
				<span class = 'desc'></span>
				<br>
				<?php if( $data['upload'] != '' ){ ?>
					<a href = "<?php echo $data['upload'];?>" target = "_blank"><img src="http://localhost/kpi/html/images/filetype_icons/<?php echo $data['icon'];?>"></a>
					<a href = "common-delete-file.php?id=<?php echo $data['id'];?>">ลบไฟล์</span>
				<?php } ?>
			</li>
			<li>
				<input type = 'submit' value = ' ตกลง ' class = 'submit'>
				<input type = 'button' value = ' ยกเลิก ' class = 'submit' onclick = "location.href='common.php'">
			</li>
		</ul>
	</form>
</div>

<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("footer") . ( substr("footer",-1,1) != "/" ? "/" : "" ) . basename("footer") );?>